<h1><?php echo __(ucfirst($action).' image'); ?></h1>

<form action="<?php echo get_url('plugin/pgallery/save_item') ?>" method="POST" enctype="multipart/form-data">

	<input type="hidden" name="item[item_id]" value="<?php echo $item->item_id ?>" />

	<table class="fieldset" cellpadding="0" cellspacing="0" border="0">
		
		
		<!-- field: file -->
		<tr>
			<td class="label"><label for="file"><?php echo __('File') ?></label></td>
			<td class="field"><input id="file" name="file" type="file" class="textbox" /></td>
			<td class="help"><?php echo __('Choose a file from your comptuer to upload. Required.'); ?></td>
		</tr>
		
		
		<!-- field: name -->
		<tr>
			<td class="label"><label for="name"><?php echo __('Name') ?></label></td>
			<td class="field"><input class="textbox" id="name" maxlength="50" name="item[name]" size="50" type="text" value="<?php echo $item->name ?>" /></td>
			<td class="help"><?php echo __('Required.'); ?></td>
		</tr>
		
		
		<!-- field: category -->
		<tr>
			<td class="label"><label for="category"><?php echo __('Category') ?></label></td>
			<td class="field"><select name="item[category_id]" id="category">
				<?php
				print_r($cats);
				foreach($cats as $id => $name){
					echo sprintf('<option value="%s">%s</option>', $id, $name);
				}
				?></select>
			</td>
			<td class="help" valign="top">Choose which category this image should belong to</td>
		</tr>
		
		
		<!-- field: description -->
		<tr>
			<td class="label"><label for="description"><?php echo __('Description') ?></label></td>
			<td class="field"><textarea name="item[description]" id="description" class="textarea" rows="4"><?php echo $item->description ?></textarea></td>
			<td class="help" valign="top">A description of this image</td>
		</tr>
		
		
	</table>


	<p class="buttons">
	<input class="button" name="commit" type="submit" accesskey="s" value="<?php echo __('Save'); ?>" />
	<?php echo __('or'); ?> <a href="<?php echo get_url('plugin/pgallery') ?>"><?php echo __('Cancel'); ?></a>
	</p>


</form>


<script type="text/javascript">
// <![CDATA[
Field.activate('name');
// ]]>
</script>